<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">

	<rich:panel id="Edit">
		<h:panelGrid>


			<a4j:form>
				<h:panelGrid columns="2">

							<s:decorate template="/layout/input.xhtml">
								<ui:define name="label">Codigo</ui:define>
								<h:inputText value="#{editCountry.editCountry.cod}" id="CountryCode"
									required="true" size="7"
									requiredMessage="Favor introduzca un codigo"
									validatorMessage="El codigo no puede ser menor a 3 o mayor a 5">
									<f:validateLength minimum="3" maximum="5" />
									<a4j:support event="onblur" />

								</h:inputText>
								<div class="msg_container">
								<rich:message for="CountryCode"/>
								</div>
							</s:decorate>
							<div style="clear: both;" />
							
							<s:decorate template="/layout/input.xhtml">
								<ui:define name="label">Descripcion</ui:define>
								<rich:comboBox value="#{editCountry.editCountry.descrip}"
									id="CountryDescrip" 
									required="true"
									requiredMessage="Favor introduzca el nombre de la moneda"
									validatorMessage="El nombre no puede ser menor a 3 o mayor a 15"
									width="100">
									<a4j:support event="onblur" />
									<f:selectItems value="#{editCountry.countries}"/>
								</rich:comboBox>
								<div class="msg_container">
								<rich:message for="CountryDescrip"/>
								</div>
							</s:decorate>
							<div style="clear: both;" />
							
							<s:decorate template="/layout/input.xhtml">
								<ui:define name="label">Iso</ui:define>
								<h:inputText value="#{editCountry.editCountry.iso}" id="CountryAbrev"
									required="true" size="5"
									requiredMessage="Favor introduzca una abreviatura"
									validatorMessage="El codigo no puede ser menor a 2 o mayor a 3">
									<f:validateLength minimum="2" maximum="3" />
									<a4j:support event="onblur" />

								</h:inputText>
								<div class="msg_container">
								<rich:message for="CountryAbrev"/>
								</div>

							</s:decorate>
							<div style="clear: both;" />
												
							<s:decorate template="/layout/input.xhtml">
								<ui:define name="label">Moneda</ui:define>
							
								
								<rich:comboBox value="#{editCountry.editCountry.currencyData}" 
								id="CountryCurrency"
								converter="#{currencyConverter}"
								converterMessage="Favor seleccione la moneda"
								defaultLabel="Seleccione la moneda"
								enableManualInput="false"
								required="true"
								requiredMessage="Favor seleccione la moneda">
															
									<s:selectItems  value="#{withinHolder.currencyList()}" var="cur" label="#{cur.descrip}">
									</s:selectItems>
									
								</rich:comboBox>
								<div class="msg_container">
								<rich:message for="CountryCurrency"/>
								</div>	

							</s:decorate>
							<div style="clear: both;" />
					
							<s:decorate template="/layout/input.xhtml">
								<ui:define name="label">Activo</ui:define>
								<h:selectBooleanCheckbox value="#{editCountry.editCountry.status}" id="CountryState"
								required="false" 
								validatorMessage="El estado no puede ser menor o mayor a 1">
								<a4j:support event="onblur" />
								</h:selectBooleanCheckbox>
								
								<div class="msg_container">
								<rich:message for="CountryState"/>
								</div>
							</s:decorate>

				</h:panelGrid>

				<s:decorate template="/layout/displayButton.xhtml">
					<a4j:commandButton value="Guardar"
						action="#{editCountry.dataToEditUpd()}"
						oncomplete="#{rich:component('modalPanel')}.hide()"
						reRender="countryForm, countryGridForm" />
					<rich:spacer width="20px" />
					<h:commandButton value="Cancelar"
						oncomplete="#{rich:component('modalPanel')}.hide()" />
				</s:decorate>
				</a4j:form>
		
		</h:panelGrid>
	</rich:panel>
</ui:composition>